package com.gxuwz.mapper;

import com.gxuwz.model.entity.Department;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DepartmentMapper {
    /*查询二级学院信息*/
    @Select("select * from sys_department where depID=#{depID}")
    Department selectDepartmentByDepID(String depID);
    @Select("select * from sys_department where depName=#{depName}")
    Department selectDepartmentByDepName(String depName);
    @Select("select * from sys_department where ID=#{ID}")
    Department selectDepartmentByID(int ID);

    /*修改二级学院信息*/
    @Update("UPDATE sys_department SET depID = #{depID}, depName = #{depName} WHERE ID = #{ID}")
    int updateDepartment(Department department);

    /*添加二级学院*/
    @Insert("INSERT INTO sys_department ( depID, depName) VALUES ( #{depID}, #{depName})")
    int insertDepartment(Department department);

    /*删除二级学院*/
    @Delete("DELETE FROM sys_department WHERE ID = #{ID}")
    int deleteDepartmentByID(String ID);

    /*查询所有二级学院信息*/
    @Select("select * from sys_department")
    List<Department> getAllDepartment();
}
